﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

/// <summary>
/// 敌人的控制程序.
/// </summary>

public class Ban2Enemy : MonoBehaviour
{
    //敌人的生命值.
    public float hp = 0;
    Animator myAnimator = null;

    void Start()
    {
        myAnimator = GetComponent<Animator>();
    }

    public void OnHurt()
    {
        if (hp <= 0)
        {
            return;
        }

        hp -= 10;
        if(hp<=0)
        {
            //触发死亡动画.
            myAnimator.SetTrigger("dead");
        }
        else
        {
            //触发受伤动画.
            myAnimator.SetTrigger("hurt");
        }
    }
}
